Light gun and method for determining shot position

ABSTRACT

In a method for determining a shot position of a light gun on a display screen, a current image is captured by an image capturing device of the light gun. The method detects a screen area in the current image, calculates coordinates of an aimed point of the light gun on the display screen when the screen area has been detected, and transmits the coordinates of the aimed point of the light gun to a host computer so that a shot result of the light gun is displayed on the display screen by the host computer according to the coordinates of the aimed point of the light gun on the display screen.

BACKGROUND

1. Technical Field

Embodiments of the present disclosure relate to game control technology,and particularly to a light gun and a method for determining a shotposition of the light gun on a display screen.

2. Description of Related Art

Light guns are used to play a shot game on a cathode-ray tube (CRT)display screen; however, the light gun cannot be used on aliquid-crystal display (LCD) screen. Generally, there are two methods tosolve this problem. In a first method, a preset pixel block of aspecified color is added in the LCD screen, where the preset pixel ofthe specified color is used to recognize a shot position of the lightgun on the LCD screen. In a second method, special light equipments,such as light-emitting diode (LED) lamp holders, are positioned besidethe LCD screen, then infrared rays omitted by the LED lamp holders areused to focus with infrared rays omitted by a lens of an infrared camerapositioned on the light gun, to determine the shot position of the lightgun on the LCD screen.

However, in the first method, the pixel color in the shot game willinflect influence the accuracy of recognizing the shot position of thelight gun on the LCD screen. In the second method, the accuracy ofrecognizing the shot position of the light gun is also influenced wheninstall positions of the LED lamp holders are not suitably, and it isinconvenient for a user of the light gun because the infrared raysomitted by the LED lamp holders will disturb the sightline of the user.Therefore, an efficient method for determining a shot position of alight gun on a display screen is desired.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a schematic diagram of an example of a shot game on a displayscreen using a light gun.

FIG. 2 is a schematic diagram of one embodiment of a light gun includinga shot position determining system.

FIG. 3 is a schematic diagram of function modules of the shot positiondetermining system included in the light gun.

FIG. 4 is a flowchart of one embodiment of a method for determining ashot position of the light gun on the display screen.

FIG. 5 is a schematic diagram of an example of creating a screentemplate.

FIG. 6 shows an example of a current image captured by an imagecapturing device positioned on the light gun.

FIG. 7 is a schematic diagram of an example of detecting a screen areain the current image.

FIG. 8 is a schematic diagram of an example of virtual coordinates of anaimed point of the light gun in the detected screen area.

FIG. 9 is a schematic diagram of an example of transforming the virtualcoordinates to actual coordinates of the aimed point of the light gun onthe display screen.

FIG. 10 is a schematic diagram of an example of displaying a shot resulton the display screen according to the actual coordinates of the aimedpoint of the light gun on the display screen.

DETAILED DESCRIPTION

All of the processes described below may be embodied in, and fullyautomated via, functional code modules executed by one or more generalpurpose electronic devices or processors. The code modules may be storedin any type of non-transitory computer-readable medium or other storagedevice. Some or all of the methods may alternatively be embodied inspecialized hardware. Depending on the embodiment, the non-transitorycomputer-readable medium may be a hard disk drive, a compact disc, adigital video disc, a tape drive or other suitable storage medium.

FIG. 1 is a schematic diagram of an example of a shot game on a displayscreen 4 using a light gun 2. In one embodiment, the light gun 2 isconnected to a host computer 5 through a network (e.g., a wirelessnetwork), the host computer 5 is further connected to the display screen4 through a data cable or the network. The display screen 4 may be acathode-ray tube (CRT) display screen or a liquid-crystal display (LCD)screen.

FIG. 2 is a block diagram of one embodiment of the light gun 2 includinga shot position determining system 24. The light gun 2 further includesan image capturing device 20, a controller (e.g., a trigger) 22, astorage device 23, and at least one processor 25. It should beunderstood that FIG. 2 illustrates only one example of the light gun 2that may include more or fewer components than illustrated, or adifferent configuration of the various components in other embodiments.

In one embodiment, the image capturing device 20 may be positioned infront of the light gun 2 (e.g., near to a gunpoint). The image capturingdevice 20 may be a depth-sensing camera, such as a time-of-flight (TOF)camera. In this embodiment, the image capturing device 20 is a camerasystem that captures a distance from a target object in an imagecaptured by a lens of the image capturing device 20 (distanceinformation) using the TOF principle. The image capturing device 20 canobtain a distance between the lens and each point on the target objectthat has been captured. Thus, each image captured by the image capturingdevice 20 includes distance information between the lens and each pointon the target object in the image.

In one embodiment, the image capturing device 20 captures a digitalimage (hereinafter referred to as “image”) of the display screen 4 whenthe shot game is played on the display screen 4 using the light gun 2,and stores the captured image in the storage device 23. The shotposition determining system 24 detects a screen area 40 in the capturedimage, calculates coordinates of an aimed point (or target point) of thelight gun 2 on the display screen 4 upon the condition that the screenarea 40 has been detected, and transmits the coordinates of the aimedpoint of the light gun 2 to the host computer 5. The host computer 5displays a point (shot result) on the display screen 4 according to thecoordinates of the aimed point of the light gun 2 on the display screen4. In one embodiment, the screen area 40 may be a rectangle enclosingthe display screen 4 (see FIG. 7).

In one embodiment, the storage device 23 stores images of the displayscreen 4 and an image template of the display screen 4 (hereinafterreferred to as “screen template”). The images in this embodiment arethree dimensional (3D) images which are captured by the image capturingdevice 20. In one embodiment, the images may include frontal images, forexample. A frontal image of the display screen 4 is an image capturedwhen the display screen is facing the image capturing device 20.Depending on the embodiment, the storage device 23 may be a smart mediacard, a secure digital card, a compact flash card, or any other memorystorage device.

The shot position determining system 24 is used to receive the image(i.e., the 3D image) from the image capturing device 20, and compare theimage with the screen template to determine whether the image includesan image sub-area, which is defined as an outline of the display screen4. If the image includes such an image sub-area, the shot positiondetermining system 24 determines that the image includes the displayscreen 4, and calculates the coordinates of the aimed point of the lightgun 2 on the display screen 4, and transmits the calculated coordinatesto the host computer 5. In one embodiment, the shot position determiningsystem 24 may include computerized instructions in the form of one ormore programs that are executed by the at least one processor 25 andstored in the storage device 23 (or memory). A detailed description ofthe shot position determining system 24 will be given in the followingparagraphs.

FIG. 3 is a block diagram of function modules of the shot positiondetermining system 24 included in the light gun 2. In one embodiment,the shot position determining system 24 may include one or more modules,for example, a template creation module 201, an image obtaining module202, a screen area detection module 203, a coordinate calculation module204, and a coordinate transmitting module 205. In general, the word“module”, as used herein, refers to logic embodied in hardware orfirmware, or to a collection of software instructions, written in aprogramming language, such as, Java, C, or assembly. One or moresoftware instructions in the modules may be embedded in firmware, suchas in an EPROM. The modules described herein may be implemented aseither software and/or hardware modules and may be stored in any type ofnon-transitory computer-readable medium or other storage device. Somenon-limiting examples of non-transitory computer-readable medium includeCDs, DVDs, BLU-RAY, flash memory, and hard disk drives.

FIG. 4 is a flowchart of one embodiment of a method for determining ashot position of the light gun 2 on the display screen 4. Depending onthe embodiment, additional steps may be added, others removed, and theordering of the steps may be changed.

Before implementing the flow shown in FIG. 4, the template creationmodule 201 creates a screen template according to the distance betweenthe lens of the image capturing device 20 and each point of the image ofthe display screen 4. A detailed description is as follows.

The image capturing device 20 obtains a reference image of the displayscreen 4 (as shown in FIG. 5), and the template creation module 201determines a preset area 30 in the reference image. As shown in FIG. 5,the preset area 30 may be a smallest rectangle (represented by a dashedrectangle) enclosing the display screen 4. In one embodiment, a center“c1” of the display screen 4 in the reference image is overlapped with acenter “c2” of the reference image. A size of the preset area isdetermined to be 320*240 (width*height), and a ratio between the widthand the height is determined to be 4:3, however, it should beappreciated that other ratios such as 16:9 may be appropriate in othersituations.

A position of the aimed point of the light gun 2 may be adjusted toensure that the display screen 4 in the reference image falls in thepreset area 30, and an occupied ratio of the display screen 4 in thepreset area 30 is greater than a preset ratio (e.g., 95%). The imagecapturing device 20 transmits the reference image to the templatecreation module 201 when the controller (e.g., the trigger) 22 of thelight gun 2 is enabled.

The template creation module 201 determines a reference distance betweenthe lens of the image capturing device 20 and the display screen 4 inthe preset area 30, stores the reference distance in the screen templateof the display screen 4, and further stores the screen template in thestorage device 23. The screen template includes a sub-image of thepreset area 30 enclosing the display screen 4 and the referencedistance. In one embodiment, the reference distance is determined as adistance between the lens of the image capturing device 20 and a featurepoint in the preset area 30. For example, the feature point may be acenter point of the preset area 30.

In block S10, the image obtaining module 202 obtains a current imagecaptured by the image capturing device 20 of the light gun 2 at eachpreset time interval (e.g., one second). An example of the current imageis shown in FIG. 6.

In block S11, the screen area detection module 203 detects a screen area40 in the current image (as shown in FIG. 7) by comparing the screentemplate with the current image. A detailed description is provided asfollows.

The screen area detection module 203 obtains the reference distance fromthe screen template, a reference ratio between the width and the heightof the display screen 4 in the screen template, and a reference size ofthe display screen 4 in the screen template. In one embodiment, thereference ratio is determined to be a ratio between the width and theheight of the preset area 30 enclosing the display screen 4, and thereference size is determined to be a size of the preset area 30enclosing the display screen. For example, when the size of the presetarea 30 is 320*240 (W*H), the reference ratio is determined to be 4:3.

The screen area detection module 203 determines whether the currentimage has the screen area 40 by determining whether an image sub-area (asub-area of the current image) has a specified number of points in thecurrent image. For example, suppose that the image sub-area may store anumber Q1 of points, and the specified number may be set as Q1*90%. Inthis embodiment, the screen area detection module 203 obtains a currentdistance between each of the specified number of points and the lens ofthe image capturing device 20, a current ratio between the width and theheight of the image sub-area, and a current size of the image sub-area.If each of the current distances is equal to the reference distance, thecurrent ratio is equal to the reference ratio (e.g., 4:3), and thecurrent size is equal to the reference size, then the screen areadetection module 203 determines that the image sub-area is the screenarea 40 detected in the current image. For example, as shown in FIG. 7,the rectangle represents the screen area 40 detected in the currentimage.

In other embodiment, if a first deviation value between each of thecurrent distances and the reference distance falls in a first presetrange (e.g., [−5%, 5%]), a second deviation value between the currentratio and the reference ratio falls in a second preset range (e.g.,[−4%, 4%]), and a third deviation value between the current size and thereference size falls in a third preset range (e.g., [−2%, 2%]), thescreen area detection module 203 determines that the image sub-area isthe screen area 40 detected in the current image.

In block S12, the screen area detection module 203 determines whetherthe screen area 40 has been detected in the current image. If the screenarea 40 has been detected in the current images, the procedure goes toblock S13. If the screen area 40 has not been detected in the currentimage, the procedure returns to block S10.

In block S13, the coordinate calculation module 204 calculates actualcoordinates of the aimed point of the light gun 2 on the display screen4 according to a virtual size of the screen area 40 and an actual sizeof the display screen 4, and stores the actual coordinates in thestorage device 23. In one embodiment, the actual coordinates aredetermined to be a shot position of the light gun 2 of the shot game onthe display screen 4. A detailed description is as follows.

The coordinate calculation module 204 creates a virtual coordinatesystem of the screen area 40, and obtains virtual coordinates of theaimed point of the light gun 2 in the screen area 40 (i.e., the virtualcoordinate system). In one embodiment, an origin of the virtualcoordinate system is a point in the bottom left of the screen area 40,and the aimed point of the light gun 2 is determined to be the center ofthe current image. As shown in FIG. 8, the virtual size of the screenarea 40 is 100*50, and the virtual coordinates of the aimed point of thelight gun 2 in the screen area 40 are determined to be (30, 20) bycomparing the positions between the aimed point and the origin of thevirtual coordinate system.

The coordinate calculation module 204 creates an actual coordinatesystem of the display screen 4, and transforms the virtual coordinatesto the actual coordinates of the aimed point of the light gun 2 on thedisplay screen 4 (i.e., the actual coordinate system) according to aratio between the virtual size of screen area 40 and the actual size ofthe display screen 4. For example, if the actual size of the displayscreen 4 is 1000*500, the ratio is determined as 10:1, and the actualcoordinates of the aimed point of the light gun 2 on the display screen4 are determined to be (300, 200).

In block S14, the coordinate transmitting module 205 transmits theactual coordinates to the host computer 5 in response to receiving ashot command of the light gun 2 (e.g., the trigger of the light gun 2 isenabled). The host computer 5 displays a shot result on the displayscreen 4 according to the actual coordinates of the aimed point of thelight gun 2 on the display screen 4. An example of the shot result isshown in FIG. 10. For example, the shot result may be include a point onthe display screen 4 corresponding to the actual coordinates of theaimed point of the light gun 2, and a score of the shot game.

In other embodiments, the shot position determining system 24 may beinstalled in the host computer 5. In this situation, the light gun 2transmits the current image captured by the image capturing device 20 tothe host computer 5. The host computer 5 detects the screen area 40 inthe current image, calculates the actual coordinates of the aimed pointof the light gun 2 on the display screen 4 upon the condition that thescreen area 40 has been detected, and displays the shot result on thedisplay screen 4 according to the actual coordinates of the aimed pointof the light gun 2 on the display screen 4.

It should be emphasized that the above-described embodiments of thepresent disclosure, particularly, any embodiments, are merely possibleexamples of implementations, merely set forth for a clear understandingof the principles of the disclosure. Many variations and modificationsmay be made to the above-described embodiment(s) of the disclosurewithout departing substantially from the spirit and principles of thedisclosure. All such modifications and variations are intended to beincluded herein within the scope of this disclosure and the presentdisclosure and protected by the following claims.

What is claimed is:
 1. A computer-implemented method for determining ashot position of a light gun on a display screen, the method comprising:obtaining a current image captured by an image capturing device of thelight gun; detecting a screen area in the current image by comparing thecurrent image with a screen template of the display screen, the currentimage comprising distance information between a lens of the imagecapturing device and each point of the screen area in the current image;calculating actual coordinates of the aimed point of the light gun onthe display screen according to a virtual size of the screen area and anactual size of the display screen; and transmitting the actualcoordinates to a host computer in response to receiving a shot commandof the light gun, and displaying a shot result of the light gun on thedisplay screen using the host computer according to the actualcoordinates.
 2. The method according to claim 1, wherein the screentemplate comprises a sub-image of a preset area enclosing the displayscreen and a reference distance between the lens of the image capturingdevice and the display screen in the preset area.
 3. The methodaccording to claim 2, wherein the reference distance is determined as adistance between the lens of the image capturing device and a featurepoint in the preset area.
 4. The method according to claim 2, whereinthe screen area is detected by: obtaining the reference distance fromthe screen template, a reference ratio between a width and a height ofthe preset area in the screen template, and a reference size of thepreset area in the screen template; obtaining an image sub-area in thecurrent image and a specified number of points in the image sub-area,and determining a current distance between each of the specified numberof points and the lens of the image capturing device, a current ratiobetween a width and a height of the image sub-area, and a current sizeof the image sub-area; and determining that the image sub-area is thescreen area upon the condition that each of the current distances isequal to the reference distance, the current ratio is equal to thereference ratio, and the current size is equal to the reference size. 5.The method according to claim 2, wherein the screen area is detected by:obtaining the reference distance from the screen template, a referenceratio between a width and a height of the preset area in the screentemplate, and a reference size of the preset area in the screentemplate; obtaining an image sub-area in the current image and aspecified number of points in the image sub-area, and determining acurrent distance between each of the specified number of points and thelens of the image capturing device, a current ratio between a width anda height of the image sub-area, and a current size of the imagesub-area; and determining that the image sub-area is the screen areaupon the condition that a first deviation value between each of thecurrent distances and the reference distance falls in a first presetrange, a second deviation value between the current ratio and thereference ratio falls in a second preset range, and a third deviationvalue between the current size and the reference size falls in a thirdpreset range.
 6. The method according to claim 2, wherein the actualcoordinates of the aimed point of the light gun on the display screenare calculated by: creating a virtual coordinate system of the screenarea and obtaining virtual coordinates of the aimed point of the lightgun in the screen area; creating an actual coordinate system of thedisplay screen, and transforming the virtual coordinates to the actualcoordinates of the aimed point of the light gun on the display screenaccording to a ratio between the virtual size of screen area and theactual size of the display screen.
 7. A light gun, comprising: a storagedevice; at least one processor; and one or more modules that are storedin the storage device and are executed by the at least one processor,the one or more modules comprising: an image obtaining module thatobtains a current image captured by an image capturing device of thelight gun; a screen area detection module that detects a screen area inthe current image by comparing the current image with a screen templateof the display screen, the current image comprising distance informationbetween a lens of the image capturing device and each point of thescreen area in the current image; a coordinate calculation module thatcalculates actual coordinates of an aimed point of the light gun on adisplay screen according to a virtual size of the screen area and anactual size of the display screen; and transmitting the actualcoordinates to a host computer in response to receiving a shot commandof the light gun, and displaying a shot result of the light gun on thedisplay screen using the host computer according to the actualcoordinates.
 8. The light gun according to claim 7, wherein the screentemplate comprises a sub-image of a preset area enclosing the displayscreen and a reference distance between the lens of the image capturingdevice and the display screen in the preset area.
 9. The light gunaccording to claim 8, wherein the reference distance is determined as adistance between the lens of the image capturing device and a featurepoint in the preset area.
 10. The light gun according to claim 8,wherein the screen area is detected by: obtaining the reference distancefrom the screen template, a reference ratio between a width and a heightof the preset area in the screen template, and a reference size of thepreset area in the screen template; obtaining an image sub-area in thecurrent image and a specified number of points in the image sub-area,and determining a current distance between each of the specified numberof points and the lens of the image capturing device, a current ratiobetween a width and a height of the image sub-area, and a current sizeof the image sub-area; and determining that the image sub-area is thescreen area upon the condition that each of the current distances isequal to the reference distance, the current ratio is equal to thereference ratio, and the current size is equal to the reference size.11. The light gun according to claim 8, wherein the screen area isdetected by: obtaining the reference distance from the screen template,a reference ratio between a width and a height of the preset area in thescreen template, and a reference size of the preset area in the screentemplate; obtaining an image sub-area in the current image and aspecified number of points in the image sub-area, and determining acurrent distance between each of the specified number of points and thelens of the image capturing device, a current ratio between a width anda height of the image sub-area, and a current size of the imagesub-area; and determining that the image sub-area is the screen areaupon the condition that a first deviation value between each of thecurrent distances and the reference distance falls in a first presetrange, a second deviation value between the current ratio and thereference ratio falls in a second preset range, and a third deviationvalue between the current size and the reference size falls in a thirdpreset range.
 12. The light gun according to claim 8, wherein thecoordinate calculation module calculates actual coordinates by: creatinga virtual coordinate system of the screen area and obtaining virtualcoordinates of the aimed point of the light gun in the screen area;creating an actual coordinate system of the display screen, andtransforming the virtual coordinates to the actual coordinates of theaimed point of the light gun on the display screen according to a ratiobetween the virtual size of screen area and the actual size of thedisplay screen.
 13. A non-transitory storage medium having storedthereon instructions that, when executed by a processor of a light gun,causes the light gun to perform a method for determining a shot positionof the light gun on a display screen, the method comprising: obtaining acurrent image captured by an image capturing device of the light gun;detecting a screen area in the current image by comparing the currentimage with a screen template of the display screen, the current imagecomprising distance information between a lens of the image capturingdevice and each point of the screen area in the current image;calculating actual coordinates of the aimed point of the light gun onthe display screen according to a virtual size of the screen area and anactual size of the display screen; and transmitting the actualcoordinates to a host computer in response to receiving a shot commandof the light gun, and displaying a shot result of the light gun on thedisplay screen using the host computer according to the actualcoordinates.
 14. The non-transitory storage medium according to claim13, wherein the screen template comprises a sub-image of a preset areaenclosing the display screen and a reference distance between the lensof the image capturing device and the display screen in the preset area.15. The non-transitory storage medium according to claim 14, wherein thereference distance is determined as a distance between the lens of theimage capturing device and a feature point in the preset area.
 16. Thenon-transitory storage medium according to claim 14, wherein the screenarea is detected by: obtaining the reference distance from the screentemplate, a reference ratio between a width and a height of the presetarea in the screen template, and a reference size of the preset area inthe screen template; obtaining an image sub-area in the current imageand a specified number of points in the image sub-area, and determininga current distance between each of the specified number of points andthe lens of the image capturing device, a current ratio between a widthand a height of the image sub-area, and a current size of the imagesub-area; and determining that the image sub-area is the screen areaupon the condition that each of the current distances is equal to thereference distance, the current ratio is equal to the reference ratio,and the current size is equal to the reference size.
 17. Thenon-transitory storage medium according to claim 14, wherein the screenarea is detected by: obtaining the reference distance from the screentemplate, a reference ratio between a width and a height of the presetarea in the screen template, and a reference size of the preset area inthe screen template; obtaining an image sub-area in the current imageand a specified number of points in the image sub-area, and determininga current distance between each of the specified number of points andthe lens of the image capturing device, a current ratio between a widthand a height of the image sub-area, and a current size of the imagesub-area; and determining that the image sub-area is the screen areaupon the condition that a first deviation value between each of thecurrent distances and the reference distance falls in a first presetrange, a second deviation value between the current ratio and thereference ratio falls in a second preset range, and a third deviationvalue between the current size and the reference size falls in a thirdpreset range.
 18. The non-transitory storage medium according to claim14, wherein the actual coordinates of the aimed point of the light gunon the display screen are calculated by: creating a virtual coordinatesystem of the screen area and obtaining virtual coordinates of the aimedpoint of the light gun in the screen area; creating an actual coordinatesystem of the display screen, and transforming the virtual coordinatesto the actual coordinates of the aimed point of the light gun on thedisplay screen according to a ratio between the virtual size of screenarea and the actual size of the display screen.